home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '88 / Proceedings '88 / Feldt's Object Stuff / objectMgr stuff / wTest.c < prev   
Encoding:
C/C++ Source or Header  |  1987-04-12  |  2.4 KB  |  90 lines  |  [TEXT/KAHL]

  1. /*                         Object Manager Testbed Demo                        */
  2.  
  3. #include  "objectMgr.h"
  4.  
  5. EventRecord        event;                        /* event record structure instance */
  6. EventStuff        whatHappened;                /* event detail structure instance */
  7. WindowRecord    WR;                            /* window record structure instance */
  8. WDHandle        tempH;
  9. WindowPtr        myWindow;                    /* window record structure pointer */
  10. Rect            myRect;                        /* rectangle data structure instance */
  11. MenuHandle        appleMenu,fileMenu,editMenu;/* handles for standard menus */
  12.  
  13.  
  14. main()
  15. {
  16.     Handle        objHandle,result;
  17.     char        str[256];
  18.     msgArgs        args;
  19.  
  20.     XTendInit();                                        /* Extender initialization routine */
  21.     StdMenus(&appleMenu,&fileMenu,&editMenu);            /* set up standard menus */
  22.  
  23.     do {
  24.         do {       
  25.             SystemTask();                                /* allow for DA handling */  
  26.         } while (!XTGetNextEvent(everyEvent,&event));    /* until event occurs */
  27.         HandleEvent(&event,&whatHappened);
  28.         
  29.         switch (whatHappened.ch) {
  30.             case 'n':
  31.                 SetRect(&myRect,100,100,350,200);
  32.                 tempH = setup_WData(&WR,&myRect,"\PWindowDemo1",0,
  33.                                     TRUE,TRUE,TRUE,TRUE,TRUE);
  34.                 objHandle = _msg(WINDOW,NEW,tempH);
  35.                 break;
  36.             case 'h':
  37.                 result = msg(HIDE,objHandle);
  38.                 break;
  39.             case 's':
  40.                 result = msg(SHOW,objHandle);
  41.                 break;
  42.             case 'a':
  43.                 args.objHndl = objHandle;
  44.                 args.objDat1 = ACTIVE;
  45.                 result = msg(SET_STATUS,&args);
  46.                 result = msg(ACTIVATE,objHandle);
  47.                 break;
  48.             case 'g':
  49.                 args.objHndl = objHandle;
  50.                 args.objDat1 = (LONG)400;
  51.                 args.objDat2 = (LONG)300;
  52.                 result = msg(GROW,&args);
  53.                 break;
  54.             case 'm':
  55.                 args.objHndl = objHandle;
  56.                 args.objDat1 = (LONG)10;
  57.                 args.objDat2 = (LONG)50;
  58.                 result = msg(MOVE,&args);
  59.                 break;
  60.             case 'd':
  61.                 args.objHndl = objHandle;
  62.                 args.objDat1 = INACTIVE;
  63.                 result = msg(SET_STATUS,&args);
  64.                 result = msg(DEACTIVATE,objHandle);
  65.                 break;
  66.             case 'k':
  67.                 result = msg(FREE,objHandle);
  68.                 break;
  69.             case 'c':
  70.                 result = msg(CLASS,objHandle);
  71.                 NumToString(result,str);
  72.                 BugAlert("\Pobject class: ",str,"\P","\P");
  73.                 break;
  74.             case 'b':
  75.                 result = msg(SIZE,objHandle);
  76.                 NumToString(result,str);
  77.                 BugAlert("\Pobject data size: ",str,"\P bytes","\P");
  78.                 break;
  79.             case 'q':
  80.                 result = msg(ASK_STATUS,objHandle);
  81.                 NumToString(result,str);
  82.                 BugAlert("\Pobject status: ",str,"\P","\P");
  83.                 break;
  84.             case '?':
  85.                 BugAlert("\Pn,h,s,a,d,k,c,b,q,g,m,? ","\P- commands","\P","\P");
  86.                 break;
  87.         }
  88.     } while (ExitRequest(&whatHappened) == FALSE);
  89. }
  90.